from selenium.webdriver.common.by import By

class AdminCouponVouchertemplateLocator:
    # Promo Management 菜单
    promo_management_menu = (By.XPATH, "//div[contains(@data-menu-id,'PROMO_MANAGER')]")
    # Voucher Records菜单
    voucher_template_menu = (By.CSS_SELECTOR, '[path="/console/voucherTemplate"]')

    #创建voucher template按钮
    create_voucher_template_button = (By.XPATH, '//button//span[text() = "Create"]')
    #搜索输入框
    search_input = (By.XPATH, "//input[contains(@placeholder,'Voucher Template')]")
    #搜索按钮
    search_button = (By.XPATH, "//button[contains(@class,'antd4-btn antd4-btn-default antd4-btn-icon-only antd4-input-search-button')]")
    # edit按钮
    edit_template_button = (By.XPATH, '//span[text()="Edit"]')
    # 操作按钮的3个点 ...
    actions_button = (By.XPATH, "//span[contains(@class,'anticon anticon-ellipsis table-operation-ellipsis')]")
    # copy按钮
    copy_template_button = (By.XPATH, '//span[text()="Copy"]')
    # distribute按钮
    distribute_button = (By.XPATH, '//span[text()="Distribute"]')
    # generate按钮
    generate_button = (By.XPATH, '//span[text()="Generate"]')
    #disable 按钮
    disable_button = (By.XPATH, '//span[text()="Disabled"]')
    #Enabled 按钮
    enable_button = (By.XPATH, '//span[text()="Enabled"]')
    enable_button_high_light = (By.XPATH, '(//li[contains(@class,"antd4-dropdown-menu-item antd4-dropdown-menu-item-only-child")])[2]')
    enable_button_not_high_light = (By.XPATH, "//li[contains(@class,'antd4-dropdown-menu-item antd4-dropdown-menu-item-disabled antd4-dropdown-menu-item-only-child')]")
    #disable 的ok按钮
    disable_ok_button = (By.XPATH, '//span[text()="OK"]')

    # 第一个查询结果
    first_search_result = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[1]')
    # 第一个查询结果的fixed amount的值
    first_search_result_fixed_amount = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[3]')
    # 第一个查询结果的reuse的值
    first_search_result_reuse = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[4]')
    # 第一个查询结果的Validation Period的值
    first_search_result_validation_period = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[5]')

    # template 列表字段
    # Voucher Template
    voucher_template_list_voucher_template = (By.XPATH, '//th[text() = "Voucher Template"]')
    voucher_template_list_status = (By.XPATH, '//span[text() = "Status"]')
    voucher_template_list_fixed_amount = (By.XPATH, '//th[text() = "Fixed Amount"]')
    voucher_template_list_reuse = (By.XPATH, '//th[text() = "Reuse"]')
    voucher_template_list_validation_period = (By.XPATH, '//th[text() = "Validation Period (UTC+08:00)"]')
    voucher_template_list_creator = (By.XPATH, '//th[text() = "Creator"]')
    voucher_template_list_creation_time = (By.XPATH, '//th[text() = "Creation Time (UTC+08:00)"]')

    #############创建voucher template页面
    voucher_template_input = (By.XPATH, '//*[@id="templateName"]')
    fixed_amount_input = (By.XPATH, "//input[contains(@placeholder,'0~99,999,999,999')]")
    currency_button = (By.XPATH, "//span[contains(@class,'antd4-select-selection-item')]")
    currency_IDR = (By.XPATH, "//div[contains(@title,'IDR')]")
    currency_ZAR = (By.XPATH, '//span[text() = "ZAR"]')

    reuse_button = (By.XPATH, '//*[@id="reuse"]')
    description_input = (By.XPATH, "//input[contains(@placeholder,'Enter description')]")
    #Validation Type
    validation_type_fixed = (By.XPATH, '//*[@id="useDefaultValidityPeriod"]/label[1]/span[1]/input')
    validation_type_dynmic = (By.XPATH, '//*[@id="useDefaultValidityPeriod"]/label[2]/span[1]/input')

    #validation period 时间选择
    start_time_input = (By.XPATH, '//*[@id="effTime"]')
    end_time_input = (By.XPATH, "//input[contains(@placeholder,'End Date')]")

    start_time = (By.XPATH, '/html/body/div[3]/div/div/div/div[2]/div/div[1]/div/div[2]/table/tbody/tr[5]/td[7]/div')
    end_time = (By.XPATH, '/html/body/div[3]/div/div/div/div[2]/div/div[2]/div/div[2]/table/tbody/tr[5]/td[7]/div')

    # submit按钮
    submit_button = (By.XPATH, '//button//span[text() = "Submit"]')

    #################################################详情页面
    # template history 页签的第一条记录
    # Voucher Template的值
    first_history_voucher_template = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[2]')
    first_history_voucher_template_result_bind = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[6]')

    #状态筛选按钮
    status_filter_button = (By.XPATH, "//span[contains(@class,'anticon anticon-filter')]")
    status_filter_enabled_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[1]')
    status_filter_disabled_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[2]')
    status_filter_ok_button = (By.XPATH, '//span[text()="OK"]')

    ################generate 页面
    #Quantity 输入框
    quantity_input = (By.XPATH, "//input[contains(@id,'quantity')]")
    #Generate History 页签
    generate_history_tab = (By.XPATH, '//div[text()="Generate History"]')
    #查询结果的数据量
    search_result_num = (By.XPATH, "//li[contains(@class,'antd4-pagination-total-text')]")

    bind_filter_button = (By.XPATH, "//span[contains(@class,'antd4-dropdown-trigger antd4-table-filter-trigger')]")
    bind_filter_y_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[1]')
    bind_filter_n_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[2]')
    bind_filter_ok_button = (By.XPATH, '//span[text()="OK"]')
    bind_filter_reset_button = (By.XPATH, '//span[text()="Reset"]')


















